package com.room.mapper;

import com.room.pojo.Workman;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface WorkmanMapper {
    int deleteByPrimaryKey(Integer workmanId);

    int insert(Workman record);

    int insertSelective(Workman record);

    Workman selectByPrimaryKey(Integer workmanId);

    int updateByPrimaryKeySelective(Workman record);

    int updateByPrimaryKey(Workman record);

   //删除数据
    int deleteWorkById(@Param("ids")String[] ids);

    //通过编号获取到工号
    String getWorkNoById(String workmanId);

    //取的时候记住要一一对应
    @Select("select workman_id as workmanId , work_name as workName , sex as sex , phone as phone , workman_no as workmanNo from workman order by workman_id limit #{start},#{size}")
    List<Workman> getWorkByPage(@Param("start")Integer start, @Param("size")Integer size);

    @Select("select count(*) from workman")
    long getTotal();

    //通过工号获取学生
    @Select("select workman_id as workmanId , work_name as workName , sex as sex , phone as phone , workman_no as workmanNo from workman where workman_no = #{workmanNo}")
    Workman getWorkmanByNo(String workmanNo);


}